<!DOCTYPE html>
<html>
    <head>        
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="<?php echo base_url('public_source/css_source/pay.css')?>" rel="stylesheet" type="text/css" />
        <link href="<?php echo base_url('public_source/css_source/right_contend.css')?>" rel="stylesheet" type="text/css"/>
        
        <script src="<?php echo base_url('public_source/javascript/jquery-1.9.1.js');?>" type="text/javascript"></script>
        <script>
            $(document).ready(function(){
                $("#login-box input:button").click(function(){
                    var data = {
                            username :  $("#login-box input:text").val(),
                            password :   $("#login-box input:password").val()
                    };
                    $.ajax({
                        type: "POST",
                        url: "<?php echo site_url('home/login_pay');?>",
                        data: data,
                        async: false,
                        beforeSend: function(){
                                $("#error").html(""); 
                        },
                        success: function(kq){
                            var getData = $.parseJSON(kq);
                            if (getData.error === "OK")
                            {
                                $('#mask , .login-popup').fadeOut(300 , function() 
                                {
                                  $('#mask').remove();  
                                }); 
                                $('[id="2"]').click;
                                $("#acc").slideDown(500);
                                $("#no_acc").hide(500);
                                $('[name="name4"]').val(getData.name);
                                $('[name="email4"]').val(getData.email);
                            }
                            else
                            {
                                $("#error").html(getData.error);
                            } 
                        }
                    });
                    return false;
                });		
            });
        </script>
    </head>
    <body>
        <div id="login-box" class="login-popup">
            <form method="post">
                <table cellspacing="10px">
                    <tr>
                        <td>Tên đăng nhập</td>
                        <td><input id="username" name="username" type="text"></td>
                    </tr>
                    <tr>
                        <td>Mật khẩu</td>
                        <td><input id="password" name="password" type="password"></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><a style="font-size: 13px" href="<?php echo site_url("user/send_register"); ?>">Register</a> | <a style="font-size: 13px" href="<?php echo site_url("user/fg_password")?>">Forgot Password</a></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><input style="width: 100px" type="button" value="Đăng nhập"></td>
                    </tr>
                </table>

                    <?php $this->load->view("cart/error_login") ?>

            </form>
        </div>
    </body>
</html>